<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>后台管理</title>
</head>
<body>
  <h1>用户管理</h1>
  <button onclick="userLogin()">用户登录</button>
  <p id="msg"></p>
  <img id="uhead" src="" style="display: none;">
</body>
<script src="./js/jquery.min.js"></script>
<script>

  
  function userLogin() {
    // 用户登录
    $.ajax({
      type: 'post',
      url: 'http://127.0.0.1:3000/user/login2',
      data: {uname: '13666006600', upd: '123456'},
      dataType: 'json',
      success: function (data) {
        console.log(data);
        $('#msg').text(`欢迎${data.data.unickname}登录。`);
        $('#uhead').css('display', 'inline-block');
        $('#uhead').attr('src', data.data.uhead);
      },
      error: function (xhr, type) {
        console.log(xhr, type);
      }
    });
  }
</script>
</html>